#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__

#include "cocos2d.h"
#include "LightPlayer.h"
#include "LightFile.h"
#include "LightAbstractRenderer.h"
#include "ccTypes.h"
#include "LightRendererGL.h"


using namespace LightPlayer;

class Renderer : public LightAbstractRenderer {
	array<cocos2d::CCTexture2D*>		m_Textures;
	cocos2d::ccColor4F					m_Color;
	float								m_PointSize;
	uint32								m_MaskStack;
	array<CXFORM>						m_CXFormStack;
public:
	Renderer();

	virtual void beginDraw() {};
	virtual void endDraw() {};

	virtual void pushMatrix( const MATRIX& transform );
	virtual void DrawLine( const vec2& origin, const vec2& destination );
	virtual void DrawQuadBezier(const vec2& origin, const vec2& control, const vec2& destination, uint32 segments);
	virtual void DrawPoint( const vec2& point );
	virtual void DrawSolidTris( const array<vec2>& Tris );
	virtual void DrawSolidTrisTextured( const array<vec2>& Tris, const array<vec2>& UVs, uint32 texture );
	virtual void DrawSolidTrisGradient( const array<vec2>& Tris, const array<vec2>& UVs, const GRADIENT& Gradient );
	virtual void popMatrix();

	// mask 
	virtual void PushMask_Start();
	virtual void PushMask_End();
	virtual void PopMask_Start();
	virtual void PopMask_End();

	virtual void setCurrentColor(float r, float g, float b, float a);
	virtual void setPointSize( float pointSize );

	virtual void pushCXFORM(const CXFORM& new_cxform, bool use_stack_transform = true);
	virtual void popCXFORM();

	virtual uint32 createTextureFromRowData( uint8* _rowData, uint32 width, uint32 height );
};


class HelloWorld : public cocos2d::CCLayer
{
	::LightPlayer::LightFile	swfFile;
	::LightPlayer::LightFile	swfFile2;
	Renderer					renderer;
	LightRendererGL				LightRenderer;
public:
    // Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
    virtual bool init();  

    // there's no 'id' in cpp, so we recommend returning the class instance pointer
    static cocos2d::CCScene* scene();
    
    // a selector callback
    void menuCloseCallback(CCObject* pSender);
    
	virtual void draw(void);
	virtual void update(float dt);

    // implement the "static node()" method manually
    CREATE_FUNC(HelloWorld);
};




#endif // __HELLOWORLD_SCENE_H__
